let input = [
    {
      id: 0,
      date: '2021-09-02',
      value: 1
    },
    {
      id: 1,
      date: '2021-09-03',
      value: 1
    },
    {
      id: 0,
      date: '2021-09-02',
      value: 2
    },
    {
      date: '2021-09-04',
      value: 2
    },
    {
      date: '2021-09-02',
      value: 6
    }
  ]
let output = []
let dict = []
  for (let j = 0; j < input.length; j++) {
    let obj = input[j]
    if (dict.includes(obj.date)) {
      for (let i = 0; i < output.length; i++) {
        let date = output[i][0]
        if (date === obj.date) {
          output[i].push(obj.value)
          // console.log(typeof output[i])
        }
      }
    } else {
      let num = obj.date
      let v = obj.value
      let r = [num, v]
      output.push(r)
      dict.push(obj.date)
    }
  }
  console.log(output)